package com.heima.utils.thread;

import com.heima.model.wemedia.pojos.WmUser;

/**
 * @author shiminghui
 * @date 2024/10/31 20:58
 * @description: TODO
 */
public class WmUserThreadLocal {

    private static final ThreadLocal<WmUser> WM_USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 获取用户信息
     *
     * @return
     */
    public static WmUser getUser() {
        return WM_USER_THREAD_LOCAL.get();
    }

    /**
     * 设置用户信息
     *
     * @param wmUser
     */
    public static void setUser(WmUser wmUser) {
        WM_USER_THREAD_LOCAL.set(wmUser);
    }

    /**
     * 删除用户信息
     *
     * @return
     */
    public static void removeUser() {
        WM_USER_THREAD_LOCAL.remove();
    }
}
